#include <algorithm>
#include <numeric>
#include <vector>
#include <map>

class WhichOfTheTwoWin {
public:
    enum class Who {
        A,
        B,
    };
    static auto who_wins(std::map<Who, int> votes_for, std::map<Who, int> judges_favor_for, int judges) {
        std::map<Who, bool> win_for;
        
        win_for[Who::A] = (votes_for[Who::A] > votes_for[Who::B] && judges_favor_for[Who::A] >= 1) || judges_favor_for[Who::A] == judges;

        win_for[Who::B] = (votes_for[Who::B] > votes_for[Who::A] && judges_favor_for[Who::B] >= 1) || judges_favor_for[Who::B] == judges;

        return (win_for[Who::A] == true) ? Who::A : Who::B;
    }
};

#include <iostream>

int main() {
    using Judge = WhichOfTheTwoWin;

    constexpr int how_many_judges = 3;
    
    std::map<Judge::Who, int> votes_for;

    std::cin >> votes_for[Judge::Who::A] >> votes_for[Judge::Who::B];

    std::map<Judge::Who, int> judges_favor_for;

    judges_favor_for[Judge::Who::A] = 0;
    judges_favor_for[Judge::Who::B] = 0;

    for (int i = 0; i < how_many_judges; ++i) {
        int choice;
        std::cin >> choice;
        judges_favor_for[(choice == 0 ? Judge::Who::A : Judge::Who::B)] += 1;
    }

    auto winner = WhichOfTheTwoWin::who_wins(votes_for, judges_favor_for, how_many_judges);

    std::cout << "The winner is " 
        << (winner == Judge::Who::A ? "a" : "b") 
        << ": " 
        << votes_for[winner] << " + " << judges_favor_for[winner];
    
    return 0;
}
